package com.ssy.lingxi.member.merchant.entity;

import com.ssy.lingxi.member.merchant.handler.converter.JpaJsonToFileListConverter;
import com.ssy.lingxi.member.merchant.model.bo.FileBO;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 会员整改
 * @author yzc
 * @version 2.0.0
 * @date 2021/5/17
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_rectify")
public class MemberRectifyDO implements Serializable {
    private static final long serialVersionUID = 2569952306326167701L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "member_rectify_seq")
    @SequenceGenerator(sequenceName = "ms_mc_member_rectify_seq", name = "member_rectify_seq", allocationSize = 1)
    private Long id;

    /**
     * 整改单号
     */
    @Column(columnDefinition = "varchar(20)")
    private String rectifyNo;

    /**
     * 外部状态 1-待发送整改通知 2-待进行整改 3-待确认整改结果 4-确认整改结果不通过 5-确认整改结果通过
     */
    @Column
    private Integer outerStatus;

    /**
     * 内部状态
     */
    @Column
    private Integer innerStatus;

    /**
     * 工作流任务Id
     */
    @Column
    private String taskId;

    /**
     * 整改主题
     */
    @Column(columnDefinition = "varchar(50)")
    private String subject;

    /**
     * 多对一单向关联上級级会员
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "member_id", referencedColumnName = "id")
    private MemberDO member;

    /**
     * 上级角色
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "role_id", referencedColumnName = "id")
    private RoleDO role;

    /**
     * 多对一单向关联下级会员
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "sub_member_id", referencedColumnName = "id")
    private MemberDO subMember;

    /**
     * 下级会员角色
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "sub_role_id", referencedColumnName = "id")
    private RoleDO subRole;

    /**
     * 整改期限开始
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime rectifyTimeStart;

    /**
     * 整改期限结束
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime rectifyTimeEnd;

    /**
     * 整改原因
     */
    @Column(columnDefinition = "varchar(120)")
    private String reason;

    /**
     * 整改要求
     */
    @Column(columnDefinition = "varchar(120)")
    private String require;

    /**
     * 整改附件
     */
    @Convert(converter = JpaJsonToFileListConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<FileBO> attachments;

    /**
     * 整改报告摘要
     */
    @Column(columnDefinition = "varchar(120)")
    private String reportDigest;

    /**
     * 报告附件
     */
    @Convert(converter = JpaJsonToFileListConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<FileBO> reportAttachments;

    /**
     * 整改结果(是否通过) 0-否 1-是
     */
    @Column
    private Integer agreeResult;

    /**
     * 整改结果原因
     */
    @Column(columnDefinition = "varchar(120)")
    private String resultRemark;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime createTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRectifyNo() {
        return rectifyNo;
    }

    public void setRectifyNo(String rectifyNo) {
        this.rectifyNo = rectifyNo;
    }

    public Integer getOuterStatus() {
        return outerStatus;
    }

    public void setOuterStatus(Integer outerStatus) {
        this.outerStatus = outerStatus;
    }

    public Integer getInnerStatus() {
        return innerStatus;
    }

    public void setInnerStatus(Integer innerStatus) {
        this.innerStatus = innerStatus;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public MemberDO getMember() {
        return member;
    }

    public void setMember(MemberDO member) {
        this.member = member;
    }

    public RoleDO getRole() {
        return role;
    }

    public void setRole(RoleDO role) {
        this.role = role;
    }

    public MemberDO getSubMember() {
        return subMember;
    }

    public void setSubMember(MemberDO subMember) {
        this.subMember = subMember;
    }

    public RoleDO getSubRole() {
        return subRole;
    }

    public void setSubRole(RoleDO subRole) {
        this.subRole = subRole;
    }

    public LocalDateTime getRectifyTimeStart() {
        return rectifyTimeStart;
    }

    public void setRectifyTimeStart(LocalDateTime rectifyTimeStart) {
        this.rectifyTimeStart = rectifyTimeStart;
    }

    public LocalDateTime getRectifyTimeEnd() {
        return rectifyTimeEnd;
    }

    public void setRectifyTimeEnd(LocalDateTime rectifyTimeEnd) {
        this.rectifyTimeEnd = rectifyTimeEnd;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getRequire() {
        return require;
    }

    public void setRequire(String require) {
        this.require = require;
    }

    public List<FileBO> getAttachments() {
        return attachments;
    }

    public void setAttachments(List<FileBO> attachments) {
        this.attachments = attachments;
    }

    public String getReportDigest() {
        return reportDigest;
    }

    public void setReportDigest(String reportDigest) {
        this.reportDigest = reportDigest;
    }

    public List<FileBO> getReportAttachments() {
        return reportAttachments;
    }

    public void setReportAttachments(List<FileBO> reportAttachments) {
        this.reportAttachments = reportAttachments;
    }

    public Integer getAgreeResult() {
        return agreeResult;
    }

    public void setAgreeResult(Integer agreeResult) {
        this.agreeResult = agreeResult;
    }

    public String getResultRemark() {
        return resultRemark;
    }

    public void setResultRemark(String resultRemark) {
        this.resultRemark = resultRemark;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
}
